﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Maestro.aspx.cs" Inherits="Solemne3.Maestro" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Página sin título</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <asp:SiteMapPath ID="sMap" runat="server">
        </asp:SiteMapPath>
        <asp:GridView ID="gvLibrerias" runat="server" AllowPaging="True" 
            AutoGenerateColumns="False" DataKeyNames="Id" DataSourceID="SqlDataSource1" 
            PageSize="5" AllowSorting="True">
            <Columns>
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" 
                    ShowSelectButton="True" />
                <asp:BoundField DataField="Id" HeaderText="Id" ReadOnly="True" 
                    SortExpression="Id" />
                <asp:BoundField DataField="Nombre" HeaderText="Nombre" 
                    SortExpression="Nombre" />
                <asp:CheckBoxField DataField="Internacional" HeaderText="Internacional" 
                    SortExpression="Internacional" />
                <asp:BoundField DataField="Cadena" HeaderText="Cadena" 
                    SortExpression="Cadena" />
                <asp:BoundField DataField="Comprados" HeaderText="Comprados" 
                    SortExpression="Comprados" />
                <asp:BoundField DataField="Vendidos" HeaderText="Vendidos" 
                    SortExpression="Vendidos" />
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
            DeleteCommand="DELETE FROM [Libreria] WHERE [Id] = @Id" 
            InsertCommand="INSERT INTO [Libreria] ([Id], [Nombre], [Internacional], [Cadena], [Comprados], [Vendidos]) VALUES (@Id, @Nombre, @Internacional, @Cadena, @Comprados, @Vendidos)" 
            SelectCommand="SELECT * FROM [Libreria]" 
            UpdateCommand="UPDATE [Libreria] SET [Nombre] = @Nombre, [Internacional] = @Internacional, [Cadena] = @Cadena, [Comprados] = @Comprados, [Vendidos] = @Vendidos WHERE [Id] = @Id">
            <DeleteParameters>
                <asp:Parameter Name="Id" Type="Int32" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="Nombre" Type="String" />
                <asp:Parameter Name="Internacional" Type="Boolean" />
                <asp:Parameter Name="Cadena" Type="String" />
                <asp:Parameter Name="Comprados" Type="Int32" />
                <asp:Parameter Name="Vendidos" Type="Int32" />
                <asp:Parameter Name="Id" Type="Int32" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="Id" Type="Int32" />
                <asp:Parameter Name="Nombre" Type="String" />
                <asp:Parameter Name="Internacional" Type="Boolean" />
                <asp:Parameter Name="Cadena" Type="String" />
                <asp:Parameter Name="Comprados" Type="Int32" />
                <asp:Parameter Name="Vendidos" Type="Int32" />
            </InsertParameters>
        </asp:SqlDataSource>
        <asp:GridView ID="gvSucursal" runat="server" AllowPaging="True" 
            AutoGenerateColumns="False" DataKeyNames="Id" 
            DataSourceID="SqlDataSource2" AllowSorting="True">
            <Columns>
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" 
                    ShowSelectButton="True" />
                <asp:BoundField DataField="Id" HeaderText="Id" ReadOnly="True" 
                    SortExpression="Id" />
                <asp:BoundField DataField="Matriz" HeaderText="Matriz" 
                    SortExpression="Matriz" />
                <asp:BoundField DataField="Ciudad" HeaderText="Ciudad" 
                    SortExpression="Ciudad" />
                <asp:BoundField DataField="Comprados" HeaderText="Comprados" 
                    SortExpression="Comprados" />
                <asp:BoundField DataField="Vendidos" HeaderText="Vendidos" 
                    SortExpression="Vendidos" />
            </Columns>
        </asp:GridView>
        <asp:DropDownList ID="ddFiltroSuc" runat="server" 
            DataSourceID="SqlDataSource4" DataTextField="Nombre" 
            onselectedindexchanged="DropDownList1_SelectedIndexChanged">
        </asp:DropDownList>
        <asp:SqlDataSource ID="SqlDataSource4" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
            SelectCommand="SELECT [Nombre] FROM [Ciudad]"></asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
            SelectCommand="SELECT [Nombre] FROM [Libreria]"></asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
            DeleteCommand="DELETE FROM [Sucursal] WHERE [Id] = @Id" 
            InsertCommand="INSERT INTO [Sucursal] ([Id], [Matriz], [Ciudad], [Comprados], [Vendidos]) VALUES (@Id, @Matriz, @Ciudad, @Comprados, @Vendidos)" 
            SelectCommand="SELECT * FROM [Sucursal]" 
            UpdateCommand="UPDATE [Sucursal] SET [Matriz] = @Matriz, [Ciudad] = @Ciudad, [Comprados] = @Comprados, [Vendidos] = @Vendidos WHERE [Id] = @Id">
            <DeleteParameters>
                <asp:Parameter Name="Id" Type="Int32" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="Matriz" Type="Int32" />
                <asp:Parameter Name="Ciudad" Type="Int32" />
                <asp:Parameter Name="Comprados" Type="Int32" />
                <asp:Parameter Name="Vendidos" Type="Int32" />
                <asp:Parameter Name="Id" Type="Int32" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="Id" Type="Int32" />
                <asp:Parameter Name="Matriz" Type="Int32" />
                <asp:Parameter Name="Ciudad" Type="Int32" />
                <asp:Parameter Name="Comprados" Type="Int32" />
                <asp:Parameter Name="Vendidos" Type="Int32" />
            </InsertParameters>
        </asp:SqlDataSource>
    
    </div>
    </form>
</body>
</html>
